#ifndef AST_EXPRESSION_CONDITIONAL_EXPR_H
#define AST_EXPRESSION_CONDITIONAL_EXPR_H

#include "../ASTNode.h"

class LogicalORExpr;
class Expression;

/*
C99 6.5.15
conditional-expression:
		logical-OR-expression
		logical-OR-expression    ?    expression    :    conditional-expression
*/
class ConditionalExpr : public ASTNode
{
protected:
	ConditionalExpr(void)
		:ASTNode(ASTNode::conditional_expression){};
public:
	ConditionalExpr(LogicalORExpr * pLogicORExpr)
		:ASTNode(ASTNode::conditional_expression)
		,m_pLogicORExpr(pLogicORExpr)
		, m_pExpr(NULL)
		, m_pConExpr(NULL){};
	ConditionalExpr(LogicalORExpr *pLogicORExpr, Expression *pExpr, ConditionalExpr *pConExpr)
		: ASTNode(ASTNode::conditional_expression)
		, m_pLogicORExpr(pLogicORExpr)
		, m_pExpr(pExpr)
		, m_pConExpr(pConExpr){};


	virtual ~ConditionalExpr(void);

	virtual void				codeGen();
protected:
	LogicalORExpr *					m_pLogicORExpr;
	Expression *					m_pExpr;
	ConditionalExpr	*				m_pConExpr;
};

#endif

